package cn.itcast.bos.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.itcast.bos.dao.IUserDao;
import cn.itcast.bos.domain.User;
import cn.itcast.bos.service.IUserService;
import cn.itcast.bos.utils.MD5Utils;
@Service
public class UserServiceImpl implements IUserService{
	@Resource
	protected IUserDao userDao;

	public User login(User model) {
		String password = MD5Utils.md5(model.getPassword());
		List<User> list = userDao.findByNameQuery("findByUsernameAndPassword", model.getUsername(),password);
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
		
	}
}
